#ifndef commonFunc_h_
#define commonFunc_h_
#include "SDL/SDL.h"
#include "SDL/SDL_opengl.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_ttf.h"
#include "SDL/SDL_mixer.h"
#include <string>
#include <iostream>
#include <stdlib.h>
#include <list>
#include <math.h>
#include "tower.h"
#include "slowtower.h"
#include "fasttower.h"
#include "unit.h"
#include "mouse.h"
#include "pathFinding.h"
#include "missle.h"
#include "player.h"
#include <iostream>
#include "globaldef.h"
#include "unit1.h"
#include "unit2.h"
#include "gui.h"
#include <sstream>
#include "wave.h"
#include "ptrContainer.h"
#include "particle.h"
#include "textparticle.h"
//#include "states/statewrapper.h"

using std::string;
using std::list;
using std::stringstream;

GLuint loadGLTex(string pathToImg);
GLuint renderChar(char c);
SDL_Surface* initScreen(ptrContainer & dcontainer);
void handleEvents(bool & ret, int & numToWave, ptrContainer & dcontainer);
void updateArrowFlags(SDL_Event & event, unsigned char & flags);
bool handleKeysNormal(ptrContainer & dcontainer, SDL_Event & event, bool & ret, int & numToWave, unsigned char & flags, int & passcount);
void createTower(ptrContainer & dcontainer);
bool handleKeysGui(SDL_Event & event, bool & ret, mouse & m, list<tower*> & towerlist, list<unit*> & unitlist, Path* p, int & numToWave, player & theplayer, gui* g, unsigned char & flags, int & passcount);

double getDist(int x, int y, int xx, int yy);

void drawAll(list<tower*> & l);
void drawAll(list<unit*> & l, double progress);
void drawAll(list<missle*> & l);
void drawAll(list<particle*> & l, ptrContainer & dcontainer);

GLuint genTexArr(ptrContainer & dcontainer);
void drawBackground(GLuint tex);

void updateTowerTargets(ptrContainer & dcontainer, int ms);
void moveAllUnits(list<unit*> & unitlist);

void grimReaper(ptrContainer & dcontainer, int spawns);

void wave(ptrContainer & dcontainer);

double getAng(int x, int y, int xx, int yy);

void moveAll(list<missle*> & misslelist, double per, ptrContainer & dcontainer);

int nextpoweroftwo(int x);

void populateStaticVars();

void badtouch(ptrContainer & dcontainer);

void deleteTower(ptrContainer & dcontainer, list<tower*>::iterator rm);

void updateParticles(ptrContainer & dcontainer, float tim);
#endif
